home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / TEST / ANIM_TES.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.8 KB  |  91 lines

  1.  
  2. /*
  3.  * Simple test of the animation subsystem.
  4.  */
  5.  
  6. package sub_arctic.test;
  7.  
  8. import sub_arctic.lib.*;
  9. import sub_arctic.output.*;
  10. import sub_arctic.input.*;
  11. import sub_arctic.anim.*;
  12.  
  13. import java.awt.Point;
  14. import java.awt.Font;
  15.  
  16. public class anim_test extends interactor_applet implements callback_object {
  17.   
  18.   public void build_ui(base_parent_interactor tl) {
  19.     long now=time_interval.now();
  20.  
  21.     pacer p1=new slow_in_slow_out(0.35,0.2);
  22.  
  23.     anticipation_line lt1=new anticipation_line(300,100,100,100,p1);
  24.     anticipation_line lt2=new anticipation_line(100,100,300,100,p1);
  25.     anticipation_line lt3=new anticipation_line(50,50,320,320,p1);
  26.  
  27.     time_interval ti=new time_interval(now+4000,now+4000+4000),after,same;
  28.     label thelabel,otherlabel;
  29.     anim_mover_container sc,sc2;
  30.     transition t,t2,t3;
  31.  
  32.     /* make the labels */
  33.     thelabel=new label("Watch This!",
  34.                new Font("Helvetica",Font.BOLD,16));
  35.     otherlabel=new label("Watch Me Too!",
  36.              new Font("Helvetica",Font.BOLD,16));
  37.     /* put the label in a sprite container ... only the first interactor
  38.        gets the callbacks*/
  39.     sc=new anim_mover_container(100,100,thelabel,this);
  40.     /* make another container for the other label */
  41.     sc2=new anim_mover_container(50,50,otherlabel);
  42.     /* make a transition */
  43.     t=new transition(sc,ti,lt2);
  44.     /* create another transition that is 2 secs after t */
  45.     after=new time_interval(time_interval.AFTER_END_OF,
  46.                 t,2000);
  47.     after.set_duration(3000);
  48.     t2=new transition(sc,after,lt1);
  49.     /*another transition that starts at same time as t*/
  50.     same=new time_interval(time_interval.AFTER_START_OF,t,
  51.                0);
  52.     same.set_duration(5000);
  53.  
  54.     t3=new transition(sc2,same,lt3);
  55.     /* set the transition onto the main sprite container */
  56.     sc.set_transition(t);
  57.     sc.set_transition(t2);
  58.     /* put the one on the other sprite container */
  59.     sc2.set_transition(t3);
  60.     /* put the whole thing in the toplevel */
  61.     tl.add_child(sc);
  62.     tl.add_child(sc2);
  63.   }
  64.   public void callback(interactor       from_obj, event            evt,
  65.                int callback_num,  Object info)  {
  66.     System.out.println("Callback called: number is " + callback_num);
  67.   }
  68.  
  69. }
  70.  
  71.  
  72.  
  73.  
  74.  
  75. /*=========================== COPYRIGHT NOTICE ===========================
  76.  
  77. This file is part of the subArctic user interface toolkit.
  78.  
  79. Copyright (c) 1996 Scott Hudson and Ian Smith
  80. All rights reserved.
  81.  
  82. The subArctic system is freely available for most uses under the terms
  83. and conditions described in 
  84.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  85. and appearing in full in the lib/interactor.java source file.
  86.  
  87. The current release and additional information about this software can be 
  88. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  89.  
  90. ========================================================================*/
  91.